package com.yusys.pattern.mode.decorator.mybatis;

/**
 * 操作缓存 线程同步装饰类
 */
public class SynchronizedCache implements Cache {

    private final Cache dalegate;

    public SynchronizedCache(Cache cache){
        dalegate = cache;
    }

   // @Override
    public synchronized Object getCache(String key) {
        System.out.println("-------SynchronizedCache get cached key "+key);
        return dalegate.getCache(key);
    }

   // @Override
    public synchronized void putObject(String key, Object value) {
        System.out.println("-------SynchronizedCache put cached key "+key);
        dalegate.putObject(key,value);
    }
}
